import http from '@/utils/http'

const operationApi = '/operation'
/** 获取销售订单列表-接口 /market/list
 * @param endTime 截至时间
 * @param openTime 开始时间
 * @param machineIds  设备id Array
 * @param pageNum  页码
 * @param pageSize 分页数量
 */
export const postSalesOrderApi = (page, data) => {
  return http({
    method: 'post',
    url: operationApi + '/market/list' + `?pageNum=${page.pageNum}&pageSize=${page.pageSize}`,
    data,
  })
}

/** 根据时间段获取销售详情-接口 /market/frame
 * @param endTime 截至时间
 * @param openTime 开始时间
 * @param machineIds  设备id Array
 * @param pageNum  页码
 * @param pageSize 分页数量
 */
export const postSalesDetailDateApi = (data) => {
  return http({
    method: 'post',
    url: operationApi + '/market/frame',
    data,
  })
}

/** 统计销售接口（维度本月、本周、日）-接口 /market */
export const getStatisticalSalesApi = (params) => {
  return http({
    method: 'get',
    url: operationApi + '/market',
    params,
  })
}

/** 每周活跃度-接口 /market/liveness */
export const getWeeklyActivityApi = (params) => {
  return http({
    method: 'get',
    url: operationApi + '/market/liveness',
    params,
  })
}

/** 每月销售详情-接口 /market/monthly */
export const getMonthlySalesDetailsApi = (params) => {
  return http({
    method: 'get',
    url: operationApi + '/market/monthly',
    params,
  })
}
